Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job.BuildNumberAssigner #9846

Merged
merged 2 commits into from
Nov 2, 2024
Merged

Conversation

jglick
Copy link
Member

@jglick jglick commented Oct 8, 2024

In CloudBees CI in high availability mode, the default behavior of Job.assignBuildNumber (updating a counter in memory, and writing it to disk) is not suitable for rapid build triggers of a single job; an external counter is needed at least transiently (the nextBuildNumber file is fine for a durable count). This beta extension point allows a plugin to swap in an alternate strategy for maintaining the next build number.

The BuildNumberAssignment return type is a bit awkward but I could not think of a better API. Job.saveNextBuildNumber is protected, so not usable from alternate implementations, and I did not want to make it public solely for the benefit of a beta API. (Introducing a public alias also seemed weird.) The method introduced in #9019 does not save, whereas the older updateNextBuildNumber method remains undesirable here because of its call to getLastBuild. Automatically calling saveNextBuildNumber from assignBuildNumber would change sychronization behavior for the default implementation, and making assignBuildNumber be synchronized would be undesirable for the CloudBees CI implementation. Reworked, I hope more clearly.

This PR makes #9778 not strictly necessary but I think it remains appropriate anyway.

Testing done

Effectiveness confirmed by a functional test in CloudBees CI.

Proposed changelog entries

  • N/A

Before the changes are marked as ready-for-merge:

Maintainer checklist

@jglick jglick requested a review from Vlatombe October 8, 2024 19:54
@jglick jglick requested a review from Vlatombe October 9, 2024 14:23
Copy link
Member

@Vlatombe Vlatombe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jglick jglick requested a review from a team November 1, 2024 20:38
@timja timja added the skip-changelog Should not be shown in the changelog label Nov 1, 2024
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Nov 1, 2024
@MarkEWaite MarkEWaite merged commit 1892e21 into jenkinsci:master Nov 2, 2024
16 checks passed
@jglick jglick deleted the BuildNumberAssigner branch November 4, 2024 18:12
@MarkEWaite
Copy link
Contributor

Plugin BOM reports a test failure in the jacoco plugin when testing weekly with Jenkins 2.484.

jenkinsci/bom#3912 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants